<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="/include/commonHeader::commonHeader('人员冲突列表')"></head>
<body class="gray-bg layer-blue">
<div class="wrapper wrapper-content animated fadeInRight full-container">
    <div class="row" id="container">
        <div class="ibox float-e-margins">
            <div class="ibox-content">
                <table id="exampleTable" data-classes="table table-hover table-condensed">
                </table>
            </div>
        </div>
    </div>
</div>

<script src="/plugins/layer/layer.js"></script>
<script type="text/javascript">
    //var p_edit = 'hidden';
    var p_edit = '';
</script>
<shiro:hasPermission name="crew:crewConflict:edit">
    <script type="text/javascript">
        p_edit = '';
    </script>
</shiro:hasPermission>

<!-- 自定义js -->
<script th:inline="javascript">
    var prefix = "/crewFlightHours";
    var workcode = "[[${workcode}]]".substr(1,"[[${workcode}]]".length-2);
    var month = "[[${month}]]".substr(1,"[[${month}]]".length-2);

    $(function () {
        load();
    });
    function load() {
        var myDate = new Date();
        myDate.getFullYear(); //获取当前年份(2位)
        $('#query_year').val(myDate.getFullYear());
        $('#exampleTable').bootstrapTable(
            {
                method: 'post',
                url: prefix + "/listItems.do",
                //iconSize: 'outline',
                toolbar: '#exampleToolbar',
                striped:true,
                showRefresh:true,
                dataType:'json',
                locale:"zh-CN",
                pagination:false,//是否分页
                contentType: "application/x-www-form-urlencoded",
                queryParams: function (params) {
                    return {
                        workcode: workcode,
                        month: month,
                    };
                },
                columns: [
                    {
                        field: 'idx',
                        formatter: orderFormatter,
                        title: '序号',
                        align: 'center',
                        width: '40'
                    },
                    {
                        field: 'flightDate',
                        title: '日期',
                        formatter: function(value,row){
                            return value.split(" ")[0];
                        },
                    },
                    {
                        field: 'flightNo',
                        title: '航班号'
                    },
                    {
                        field: 'departureAirport',
                        title: '起飞机场'
                    },
                    {
                        field: 'arrivalAirport',
                        title: '目的机场'
                    },
                    {
                        field: 'std',
                        title: '计飞时刻',
                        formatter: function(value,row){
                            return value.split(" ")[1];
                        },
                    },
                    {
                        field: 'sta',
                        title: '计达时刻',
                        formatter: function(value,row){
                            return value.split(" ")[1];
                        },
                    },
                    {
                        field: 'flightDuration',
                        title: '飞行时间',
                        formatter: function(value,row){
                            return (value/60).toFixed(2);
                        },
                    },
                   ]
            })
    }


    //刷新
    function reload() {
        $("#exampleTable").bootstrapTable('refresh');
    }

    function orderFormatter(value, row, index) {
        return index + 1;
    }


</script>
</body>
</html>